package com.pet.behavior.controller;


import com.pet.behavior.service.ApUnlikesBehaviorService;
import com.pet.common.controller.AbstractController;
import com.pet.model.behavior.dtos.UnLikesBehaviorDto;
import com.pet.model.behavior.pojos.ApUnlikesBehavior;
import com.pet.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
* <p>
* APP不喜欢行为表 控制器</p>
*/
@RestController
@RequestMapping("/api/unlikesBehavior")
public class ApUnlikesBehaviorController extends AbstractController<ApUnlikesBehavior>{

    private ApUnlikesBehaviorService apUnlikesBehaviorService;

    //注入
    @Autowired
    public ApUnlikesBehaviorController(ApUnlikesBehaviorService apUnlikesBehaviorService) {
        super(apUnlikesBehaviorService);
        this.apUnlikesBehaviorService=apUnlikesBehaviorService;
    }

    /**
     * 不喜欢行为
     * @param dto
     * @return
     */
    @PostMapping("unlike_behavior")
    public ResponseResult unLike(@RequestBody UnLikesBehaviorDto dto){
        return apUnlikesBehaviorService.unLike(dto);
    }

    /**
     * 查询不喜欢行为记录
     */
    @GetMapping("getUnlikeBehavior")
    public ResponseResult<ApUnlikesBehavior> getUnlikeBehavior(@RequestParam("entryId") Integer entryId,@RequestParam("articleId") Long articleId ){
        return apUnlikesBehaviorService.getUnlikeBehavior(entryId,articleId);
    }
}

